package uy.com.dino.samefile.dao.impl;

import uy.com.dino.samefile.dao.DaoHibernateBase;
import uy.com.dino.samefile.dao.ReviewDao;
import uy.com.dino.samefile.model.Review;

import java.util.List;

public class ReviewDaoImpl extends DaoHibernateBase<Review, Long>
        implements ReviewDao {


    @Override
    public Review getReviewByName(String reviewName) {
        Review review = null;
        Review reviewExample = new Review();
        reviewExample.setName(reviewName);

        List<Review> reviews = this.searchByExample(reviewExample, "fileInfoList", "id");
        if (reviews.size() > 0) {
            review = reviews.get(0);
        }

        return review;
    }
}
